Add Ctrl+click support for file:line:column references in terminal - #2841
Add Ctrl+click support for file:line:column references in terminal#2841RoiSoleil wants to merge 6 commits into
Conversation
|
@RoiSoleil : please sign ECA, see https://api.eclipse.org/git/eca/status/gh/eclipse-platform/eclipse.platform/2841 Without this we can't accept contributions. |
|
This pull request changes some projects for the first time in this development cycle. An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch. Git patchFurther information are available in Common Build Issues - Missing version increments. |
It's OK now ;) |
Introduce FileReference record and FileReferenceParser to handle path:line:column references displayed in the terminal (e.g., from 'git grep -n' output). - FileReferenceParser parses hover text into path + optional line/column - OpenFileMouseHandler uses it instead of inline regex parsing - Both classes in view.core.internal (x-internal, no new public API) - 25 unit tests cover plain paths, :line, :line:col, Windows paths, edge cases (zero values, URLs, timestamps, Maven coordinates)
- Strip trailing colon from path when no line/col suffix matches - Fix column offset: 1-based input -> 0-based document (col - 1) - Rename parser patterns for clarity - Make test classes/methods public - Add test for plain path ending with colon - Update time-like test: 12:30:45 parsed as path=12, line=30, col=45
- Remove <p> around <ul> list in FileReferenceParser (invalid HTML that failed javadoc doclint with 'unexpected end tag: </p>') - Use HTML entity ≥ instead of raw Unicode char - Add main descriptions to FileReference.hasLine/hasColumn
feffc6a to
c303989
Compare
FileReference and FileReferenceParser live in the x-internal package org.eclipse.terminal.view.core.internal. Referencing them from view.ui and the test bundle produces 'access restriction' compiler warnings (6 new issues in CI). Add @SuppressWarnings("restriction") at class level, matching the existing pattern used for OpenResourceDialog.
- Remove redundant @SuppressWarnings('restriction') on mouseUp, now covered by the class-level annotation - Remove @SuppressWarnings('restriction') from test classes: the test bundle sets discouragedReference=ignore, so no access-restriction warnings are produced; the annotation only generated an 'unused compiler option' info
Description
Adds support for Ctrl+click on file references with line and column numbers (e.g.,
path:42orpath:42:7) in the terminal, commonly produced bygit grep -n.Changes
C:\handled correctly)FileReferenceParserinstead of inline:\splitting and lenient regex(\\d*)(:(\\d*))?.*:line,:line:col, git grep output, Windows paths, URLs, timestamps, Maven coords, zero valuesTesting
Build with:
mvn clean verify -Pbuild-individual-bundles -pl terminal/bundles/org.eclipse.terminal.view.core,terminal/bundles/org.eclipse.terminal.view.ui,terminal/tests/org.eclipse.terminal.test -amCloses #...